package POJO;

import java.io.Serializable;

import javax.persistence.Embeddable;
import javax.persistence.ManyToOne;

@Embeddable
public class KeyStoreProductDetail implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 5245497892150886399L;

	@ManyToOne
	private Store store;

	@ManyToOne
	private ProductDetail productDetail;
	
	public KeyStoreProductDetail() {
		super();
	}
	
	public KeyStoreProductDetail(Store store, ProductDetail productDetail) {
		super();
		this.store = store;
		this.productDetail = productDetail;
	}

	public Store getStore() {
		return store;
	}

	public void setStore(Store store) {
		this.store = store;
	}

	public ProductDetail getProductDetail() {
		return productDetail;
	}

	public void setProductDetail(ProductDetail productDetail) {
		this.productDetail = productDetail;
	}

	public boolean equals(Object o) {
		if (this == o)
			return true;
		if (o == null || getClass() != o.getClass())
			return false;

		KeyStoreProductDetail that = (KeyStoreProductDetail) o;

		if (store != null ? !store.equals(that.store) : that.store != null)
			return false;
		if (productDetail != null ? !productDetail.equals(that.productDetail)
				: that.productDetail != null)
			return false;

		return true;
	}

	public int hashCode() {
		int result;
		result = (store != null ? store.hashCode() : 0);
		result = 31 * result
				+ (productDetail != null ? productDetail.hashCode() : 0);
		return result;
	}
}
